export const storage = (key: string) => ({
    get<T>(): T | null {
        const item = window.localStorage.getItem(key);
        return item ? JSON.parse(item) : null;
    },
    set<T>(value: T) {
        window.localStorage.setItem(key, JSON.stringify(value));
    },
    remove() {
        window.localStorage.removeItem(key);
    },
});

export const GetDateTime=(dateS:String)=>{
    let date=new Date(dateS)
    let year = date.getFullYear();
    let month = date.getMonth() + 1;
    let day = date.getDate();
    let hour = date.getHours();
    let min = date.getMinutes();
    let sec = date.getSeconds();
    let monthS = month >= 10 ? month : ("0" + month);
    let dayS = day >= 10 ? day : ("0" + day);
    let hourS = hour >= 10 ? hour : ("0" + hour);
    let minS = min >= 10 ? min : ("0" + min);
    let secS = sec >= 10 ? sec : ("0" + sec);
    return year + "-" + monthS + "-" + dayS + " " + hourS + ":" + minS + ":" + secS;
}

